Completed
Push — master ( d5ffb5...8c40a0 )
by Ajeh
43s
created

describe(ꞌCalling "$dialog.alert()"ꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 5
rs 9.4285
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ��) 0 3 1
1
/**
2
 * Created by Emmy on 10/8/2017.
3
 */
4
5
import Plugin from '../../../../src/plugin/js/index'
6
import {assert, expect} from 'chai'
0 ignored issues
show
Unused Code introduced by
The variable assert seems to be never used. Consider removing it.
Loading history...
7
import Vue from 'vue'
8
import Promise from 'promise-polyfill'
9
10
Vue.config.productionTip = false
11
let vm = setupVue()
12
13
describe('Calling "$dialog.alert()"', function () {
14
    it('Should return a promise', function () {
15
        vm.checkAlert()
16
    })
17
})
18
19
describe('Calling "$dialog.confirm()"', function () {
20
    it('Should return a promise', function () {
21
        vm.checkConfirm()
22
    })
23
})
24
25
console.log(document.body.innerHTML)
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
26
function setupVue() {
27
    Vue.use(Plugin)
28
29
    let div = document.createElement('div')
30
    div.id = 'app'
31
    document.body.appendChild(div)
32
33
    return new Vue({
34
        $el: '#app',
35
        methods: {
36
            checkAlert(){
37
                let dg = this.$dialog.alert('Simple Alert')
38
                expect(dg).to.be.instanceOf(Promise)
39
            },
40
            checkConfirm(){
41
                let dg = this.$dialog.confirm('Please confirm')
42
                expect(dg).to.be.instanceOf(Promise)
43
            }
44
        }
45
    })
46
}